<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>layui</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <link rel="stylesheet" href="__PUBLIC__/layui/css/layui.css"  media="all">
  <link rel="stylesheet" href="__PUBLIC__/font-awesome/css/font-awesome.min.css" media="all" />
  <link rel="stylesheet" href="__CSS__/admin.css"  media="all">
  <style type="text/css">

    /* tooltip */
    #tooltip{
      position:absolute;
      border:1px solid #ccc;
      background:#333;
      padding:2px;
      display:none;
      color:#fff;
    }
</style>
</head>
<body style="padding:10px;">
  <div class="tplay-body-div"> 

  <div class="layui-tab">
    <ul class="layui-tab-title">
      <li class="layui-this">系统参数配置</li>
      <!-- <li><a href="{:url('admin/menu/publish')}" class="a_menu">添加新菜单</a></li> -->
    </ul>
  </div>
  <table class="layui-table" lay-size="sm">
    <colgroup>
      <col width="250">
      <col width="100">
      <col width="300">
    </colgroup>
    <thead>
      <tr>
        <th>名称</th>
        <th>参数值 <font color="red">(点击参数值进行修改)</font></th>
        <th>描述</th>
      </tr> 
    </thead>
    <tbody>
        <form class="layui-form" id="admin">
      {volist name="web_config" id="vo"}
      <tr>
        <td>{$vo[0]}</td>
        <td style="height:40px;"><input type="number" id="{$vo[0]}" value="{$vo[1]}" style="width: 100%;height: 100%;border-style: none"></td>
        <td>{$vo[2]}</td>
        </td>
      </tr>
      {/volist}
    </tbody>
  </table>
    </form>
          
  {include file="public/foot"}
  <script>
  $("input").blur(function(){
     var  name =  $(this).attr('id');
     var value =   $(this).val();   
      $.ajax({
            url:"{:url('admin/config/index')}",
            data:{name:name,value:value},
            type:'post',
            async: false,
            success:function(res) {
              layer.alert(res.msg, {title: '友情提示', icon: 1, closeBtn: 0}, function(){
                   history.go(0);
               });
            }
        })
  });
$('input').bind('keypress', function (event) { 
   if (event.keyCode == "13") { 
    $('input').unbind('blur');
     var  name =  $(this).attr('id');
     var value =   $(this).val();   
      $.ajax({
            url:"{:url('admin/config/index')}",
            data:{name:name,value:value},
            type:'post',
            async: false,
            success:function(res) {

              layer.alert(res.msg, {title: '友情提示', icon: 1, closeBtn: 0}, function(){
                   history.go(0);
               });
              $('input').bind('blur');
            }
        })
   }
})
  </script>
</div>
</body>
</html>
